﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;

public class SDKManager : MonoBehaviour
{
    public static SDKManager Ins
    {
        get
        {
            return _ins;
        }
    }
    private static SDKManager _ins;
    public event UnityAction<string> commentSucess;
    public event UnityAction<string> commentFailed;
    
    public event UnityAction<string> remoteConfigSucess;
    public event UnityAction<string> remoteConfigFailed;
    
    private AndroidJavaClass _javaRemoteConfig;
    private AndroidJavaClass JAVARemoteConfig
    {
        get
        {
            _javaRemoteConfig = _javaRemoteConfig ?? new AndroidJavaClass("com.yd.other.remoteconfig.RemoteConfigImp");
            return _javaRemoteConfig;
        }
    }
    
    
    void Awake()
    {
        _ins = this;
    }
    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        
    }

    public void HandleCommentSucess(string result)
    {
        commentSucess?.Invoke(result);
       // GameModel.Ins.IsComment = true;
        Debug.Log("HandleCommentSucess");
    }

    public void HandleCommentFailed(string result)
    {
        commentFailed?.Invoke(result);
        Debug.Log("HandleCommentFailed");
    }

    public void HandleRemoteConfigFetchSucess(string sucess)
    {
        remoteConfigSucess?.Invoke(sucess);
    }

    public void HandleRemoteConfigFetchFailed(string failed)
    {
        remoteConfigFailed?.Invoke(failed); 
    }


    public string GetString(string key)
    {
#if UNITY_EDITOR
        return "";
#elif UNITY_ANDROID
        return JAVARemoteConfig.CallStatic<string>("GetString",key);
#elif UNITY_IPHONE || UNITY_IOS
       // return IOS_GetLanguage();
#else

#endif


    }
    
    
}
